package com.navigationtest;

import android.os.Bundle;
import android.view.View;

import com.hjq.bar.OnTitleBarListener;
import com.myatest.BR;
import com.myatest.R;
import com.navigationtest.adapt.StartAdapt;
import com.pbase.tools.Logger;
import com.pbase.ui.page.DataBindingConfig;

/**
 * User: psn
 * Date: 2021/12/15
 */
public class StartFragment extends NavigationViewFragment {
    private  StartViewModel mViewModel;
    @Override
    protected void onCreateViewBefore() {

    }

    @Override
    protected void onCreateViewAfter() {
        Bundle bundle = getArguments();
        if(bundle != null) {
         int age =   Test5FragmentArgs.fromBundle(bundle).getAge();
         Logger.e(getClass(),"Test5FragmentArgs age "+age);
        }
    }

    @Override
    protected void initViewModel() {
        mViewModel = getFragmentScopeViewModel(StartViewModel.class);

    }

    @Override
    protected DataBindingConfig getDataBindingConfig() {
        return new DataBindingConfig(R.layout.frg_start, BR.vm ,mViewModel)
                .addBindingParam(BR.adapt, new StartAdapt(this.getChildFragmentManager(),this.getLifecycle()))
                .addBindingParam(BR.OnTitleBarListener,new TitleBarListener());
    }
    public class TitleBarListener implements OnTitleBarListener {

        @Override
        public void onLeftClick(View view) {
            Logger.e(getClass(),"onLeftClick");
            left();
//            getActivity().finish();
        }

        @Override
        public void onTitleClick(View view) {

        }

        @Override
        public void onRightClick(View view) {

        }
    }
}
